<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<html> 
<head> 
<title></title> 
	<link rel="stylesheet" type="text/css" href="../easyui/themes/default/easyui.css">
	<link rel="stylesheet" type="text/css" href="../easyui/themes/icon.css">
	<script type="text/javascript" src="../easyui/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="../easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../js/common.js"></script>
	
	<link rel="stylesheet" type="text/css" href="../css/common.css">
	<link rel="stylesheet" type="text/css" href="../css/table.css">

<script>
function check(){
	if(fm.parent_code.value==""){
		$.messager.alert('提示','请输入上级部门编号','warning');
		return;
	}
	if(fm.name.value==""){
		$.messager.alert('提示','请输入部门名称','warning');
		return;
	} 
	fm.submit();
}
</script>
</head> 
<body>
<form action="update.html" name="fm" method="post" >
<table width="60%" border="0" cellspacing="1" align="center" cellpadding="1" class="ListTable">
	<thead>
		<tr>
			<td align="center" class="TableRow" colspan="2" nowrap style= "border-bottom:1">
					&nbsp;添加部门&nbsp;
			</td>
		</tr>
	</thead>
	<TBODY>
	<c:if test="${department!=null}">
	<TR>
		<TD width="20%" height="30" align="center" class="RecordRow" nowrap style= "border-bottom:1" style="border-right:1">部门编号&nbsp;</TD>
		<TD class="RecordRow" nowrap style= "border-bottom:1">&nbsp;
			<INPUT class=textColorWrite name="code"  <c:if test="${department!=null}">readonly style="background-color: whitesmoke"</c:if>   value="${department.code }"><font color="red" style="center">*</font>
		</TD>
	</TR>
	</c:if>
	<TR>
		<TD height="30" align="center" class="RecordRow" nowrap style= "border-bottom:1" style="border-right:1">部门名称&nbsp;</TD>
		<TD class="RecordRow" nowrap style= "border-bottom:1">&nbsp;
			<INPUT class=textColorWrite name="name" value="${department.name }"><font color="red" style="center">*</font>
		</TD>
	</TR>
	<TR>
		<TD height="30" align="center" class="RecordRow" nowrap style= "border-bottom:1" style="border-right:1">上级部门编号&nbsp;</TD>
		<TD class="RecordRow" nowrap style= "border-bottom:1">&nbsp;
			<INPUT  class=codecode name="parent_code" ondblclick="showDialog(this,'../dialog.html?type=department')"
			  size="4" value="${department.parent_code }">
			  <INPUT name="value" size="10" class="readonly" readonly>
			  <font color="red" style="center">*</font>
		</TD>
	</TR>
	<TR>
		<TD height="30" align="center" class="RecordRow" nowrap style= "border-bottom:1" style="border-right:1">创建日期&nbsp;</TD>
		<TD class="RecordRow" nowrap style= "border-bottom:1">&nbsp;
			<INPUT class=textColorWrite name="create_date" value="${department.create_date }" >
		</TD>
	</TR>
	
	<TR>
		<TD height="30" align="center" class="RecordRow" nowrap style= "border-bottom:1" style="border-right:1">备注&nbsp;</TD>
		<td  class="RecordRow" nowrap >
			<span style="float:left">	
				<textarea name="bz" cols="45" rows="4">${department.bz }</textarea>
			</span>
		</td> 
	</TR>
	<TBODY>
</table>
</form>

<table width="60%" border="0" cellspacing="1" align="center" cellpadding="1" class="ListTable">
<tr align=center>
<td>
	<c:choose>
		<c:when test="${department == null}">  
			<input type="button" class="mybutton" value='保存' onclick="check()"/> &nbsp;
		</c:when>
		<c:otherwise> 
			<input type="button" class="mybutton" value='修改' onclick="check()"/> &nbsp;
		</c:otherwise>   
	</c:choose>
	<input type="button" class="mybutton" value='返回' onclick="history.back();"/></td>
<tr>
</table>
<script>
var date = new Date();
var currentDate = date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
if("${department}" == ""){
	fm.create_date.value = currentDate;
}
</script>
</body>
</html>